home *** CD-ROM | disk | FTP | other *** search
Wrap
global fin,fout,fName,fLine,alpha,alphadot,white,nonwhite,nonalpha global classes,comp,exec,strict,links,imports,loud,compiles procedure initialize() #line 47 "idol.iol" loud := 1 comp := 0 alpha := &ucase ++ &lcase ++ '_' ++ &digits nonalpha := &cset -- alpha alphadot := alpha ++ '.' white := ' \t\014' nonwhite := &cset -- white classes := taque() links := [] imports := [] compiles := [] sysinitialize() end procedure main(args) #line 62 "idol.iol" initialize() if *args = 0 then write("usage: idol files...") else { every i := 1 to *args do { if \exec then next if args[i][1] == "-" then { case map(args[i]) of { "-c" : { sysok := &null if comp = 0 then comp := -1 } "-install": return install(args[1:i+1]) "-quiet" : loud := &null "-strict" : strict := 1 "-s" : sysok := &null "-t" : comp := -2 "-version": return write("Idol version 6.30 of 3/14/90") & 0 "-x" : exec := i } } else if args[i][find(".cl",args[i]):0] := "" then push(imports,args[i]) else if args[i][find(".icn",args[i]):0] := "" then { push(links,args[i]) icont(" -c "||args[i]) } else if args[i][find(".u1",args[i]):0] := "" then push(links,args[i]) else if (args[i][find(".iol",args[i]):0] := "") | tryopen(args[i]||".iol","r") then { /exe := i args[i][find(".iol",args[i]):0] := "" /fout := sysopen(args[i]||".icn","w") readinput(args[i]||".iol",1) } else { if tryopen(args[i]||".icn","r") then { push(links,args[i]) icont(" -c "||args[i]) } else if tryopen(args[i]||".u1") then push(links,args[i]) else if tryenvopen(args[i]) then push(imports,args[i]) } } gencode() close(\fout) if comp = 1 then makeexe(args,exe) } end procedure gencode() #line 118 "idol.iol" if \loud then write("Class import/export:") every cl := (__self1 := classes).__methods.foreach_t(__self1.__state) do (__self2 := cl).__methods.writespec(__self2.__state) repeat { added := 0 every super:= ((__self2 := ((__self1 := classes).__methods.foreach_t(__self1.__state))).__methods.foreachsuper(__self2.__state) | !imports) do{ if /(__self1 := classes).__methods.lookup(__self1.__state,super) then { added := 1 fname := filename(super) readinput(envpath(fname),2) if /(__self1 := classes).__methods.lookup(__self1.__state,super) then halt("can't import class '",super,"'") writesublink(fname) } } if added = 0 then break } every (__self2 := ((__self1 := classes).__methods.foreach_t(__self1.__state))).__methods.transitive_closure(__self2.__state) if \loud then write("Generating code:") writesublink("i_object") every s := !links do writelink(s) write(fout) every out := (__self1 := classes).__methods.foreach(__self1.__state) do { name := filename((__self1 := out).__methods.name(__self1.__state)) (__self1 := out).__methods.write(__self1.__state) put(compiles,name) writesublink(name) } if *compiles>0 then cdicont(compiles) end procedure notquote(s) #line 713 "idol.iol" quotes := 0 outs := "" s ? { while outs ||:= tab(find("\\")+1) do { move(1) } outs ||:= tab(0) } s := outs outs := "" s ? { while outs ||:= tab(find("\""|"'")+1) do { quotes +:= 1 if tab(find(outs[-1])) then { quotes +:= 1 move(1) } } } if quotes % 2 = 0 then return end procedure readln() #line 739 "idol.iol" count := 0 if line := read(fin) then { fLine +:= 1 line[ 1(x<-find("#",line),notquote(line[1:x])) : 0] := "" line := trim(line) while ((x := find("$",line)) & notquote(line[1:x])) do { z := line[x+1:0] ||" " if find(line[x+1],"!*@?") then { z ? { move(1) tab(many(white)) if not (id := tab(many(alphadot))) then { if not match("(") then halt("readline can't parse ",line) if not (id := tab(&pos<bal())) then halt("readline: cant bal ",&subject) } case line[x+1] of { "@": Op := "activate" "*": Op := "size" "!": Op := "foreach" "?": Op := "random" default: halt("readline: unknown operator $",line[x+1]) } count +:= 1 line[x:0] := "(__self"||count||" := "||id||").__methods."|| Op||"(__self"||count||".__state)"||tab(0) } } else { reverse(line[1:x])||" " ? { tab(many(white)) if not (id := reverse(tab(many(alphadot)))) then { if not match(")") then halt("readline: can't parse") if not (id := reverse(tab(&pos<bal(&cset,')','(')))) then halt("readline: can't bal ",&subject) } nummatched := &pos-1 } if not (lp := find("(",z)) then halt("readline: expected '('") if z[lp+1] ~== ")" then c:="," else c:="" count +:= 1 line[x-nummatched : x+lp+1] := "(__self"||count||" := "||id||").__methods."|| z[1:lp+1]||"__self"||count||".__state"||c } } return line } else fail end procedure readinput(name,phase) #line 795 "idol.iol" if \loud then write("\t",name) fName := name fLine := 0 fin := sysopen(name,"r") while line := readln() do { line ? { tab(many(white)) if ="class" then { decl := class() (__self1 := decl).__methods.read(__self1.__state,line,phase) if phase=1 then { (__self1 := decl).__methods.writemethods(__self1.__state) (__self1 := classes).__methods.insert(__self1.__state,decl,(__self2 := decl).__methods.name(__self2.__state)) } else (__self1 := classes).__methods.insert_t(__self1.__state,decl,(__self2 := decl).__methods.name(__self2.__state)) } else if ="procedure" then { if comp = 0 then comp := 1 decl := method("") (__self1 := decl).__methods.read(__self1.__state,line,phase) (__self1 := decl).__methods.write(__self1.__state,fout,"") } else if ="record" then { if comp = 0 then comp := 1 decl := declaration(line) (__self1 := decl).__methods.write(__self1.__state,fout,"") } else if ="global" then { if comp = 0 then comp := 1 decl := Global(line) (__self1 := decl).__methods.write(__self1.__state,fout,"") } else if ="method" then { halt("readinput: method outside class") } } } close(fin) end procedure halt(args[]) #line 838 "idol.iol" errsrc() every writes(&errout,!args) stop() end procedure warn(args[]) #line 844 "idol.iol" errsrc() every writes(&errout,!args) write(&errout) end procedure errsrc() #line 850 "idol.iol" writes(&errout,"\"",\fName,"\", line ",\fLine,": Idol/") end procedure tryopen(file,mode) #line 856 "idol.iol" if f := open(file,mode) then return close(f) end procedure tryenvopen(file,mode) #line 859 "idol.iol" return tryopen(envpath(file),mode) end procedure sysopen(file,mode) #line 862 "idol.iol" if not (f := open(file,mode)) then halt("Couldn't open file ",file," for mode ",mode) return f end procedure envopen(file,mode) #line 867 "idol.iol" return sysopen(envpath(file),mode) end procedure writelink(s) #line 870 "idol.iol" write(fout,"link \"",s,"\"") end procedure icont(argstr,prefix) #line 873 "idol.iol" static s initial { s := (getenv("ICONT")|"icont") } return mysystem(\prefix||s||argstr | s||argstr) end record idol_object(__state,__methods) procedure declarationread(self,decl) #line 169 "idol.iol" decl ? { tab(many(white)) if not (self.tag := =("procedure"|"class"|"method"|"record")) then halt("declaration/read can't parse decl ",decl) tab(many(white)) if not (self.name := tab(many(alpha))) then halt("declaration/read can't parse decl ",decl) if not tab(find("(")+1) then halt("declaration/read can't parse decl ",decl) tab(many(white)) self.fields := classFields() if not ((__self1 := self.fields).__methods.parse(__self1.__state,tab(find(")")))) then halt("declaration/read can't parse decl ",decl) } end procedure declarationwrite(self,f) #line 192 "idol.iol" write(f,(__self1 := self).__methods.String(__self1.__state)) end procedure declarationString(self) #line 198 "idol.iol" return self.tag || " " || self.name || "(" || (__self1 := self.fields).__methods.String(__self1.__state) || ")" end record declaration_state(__state,__methods,name,fields,tag) record declaration_methods(read,write,String,name) global declaration__oprec procedure declaration(name,fields,tag) local self,clone initial { if /declaration__oprec then declarationinitialize() } self := declaration_state(&null,declaration__oprec,name,fields,tag) self.__state := self declarationinitially(self) return idol_object(self,declaration__oprec) end procedure declarationinitialize() initial declaration__oprec := declaration_methods(declarationread,declarationwrite,declarationString,declarationname) end procedure declarationinitially(self) #line 201 "idol.iol" if \self.name then (__self1 := self).__methods.read(__self1.__state,self.name) end procedure declarationname(self) return .(self.name) end procedure bodyread(self) #line 210 "idol.iol" self.fn := fName self.ln := fLine self.text := [] while line := readln() do { put(self.text, line) line ? { tab(many(white)); if ="end" & &pos > *line then return } } halt("body/read: eof inside a procedure/method definition") end procedure bodywrite(self,f) #line 220 "idol.iol" if \self.ln then write(f,"#line ",self.ln," \"",self.fn,"\"") every write(f,(__self1 := self).__methods.foreach(__self1.__state)) end procedure bodydelete(self) #line 224 "idol.iol" return pull(self.text) end procedure bodysize(self) #line 227 "idol.iol" return (*\ (self.text)) | 0 end procedure bodyforeach(self) #line 230 "idol.iol" if t := \self.text then suspend !self.text end record body_state(__state,__methods,fn,ln,text) record body_methods(read,write,delete,size,foreach) global body__oprec procedure body(fn,ln,text) local self,clone initial { if /body__oprec then bodyinitialize() } self := body_state(&null,body__oprec,fn,ln,text) self.__state := self return idol_object(self,body__oprec) end procedure bodyinitialize() initial body__oprec := body_methods(bodyread,bodywrite,bodydelete,bodysize,bodyforeach) end procedure classread(self,line,phase) #line 242 "idol.iol" (__self1 := self).__methods.declaration.read(__self1.__state,line) self.supers := idTaque(":") (__self1 := self.supers).__methods.parse(__self1.__state,line[find(":",line)+1:find("(",line)] | "") self.methods:= taque() self.text := body() while line := readln() do { line ? { tab(many(white)) if ="initially" then { (__self1 := self.text).__methods.read(__self1.__state) if phase=2 then return (__self1 := self.text).__methods.delete(__self1.__state) return } else if ="method" then { decl := method(self.name) (__self1 := decl).__methods.read(__self1.__state,line,phase) (__self1 := self.methods).__methods.insert(__self1.__state,decl,(__self2 := decl).__methods.name(__self2.__state)) } else if ="end" then { return } else if ="procedure" then { decl := Procedure("") (__self1 := decl).__methods.read(__self1.__state,line,phase) /self.glob := [] put(self.glob,decl) } else if ="global" then { /self.glob := [] put(self.glob,Global(line)) } else if ="record" then { /self.glob := [] put(self.glob,declaration(line)) } else if upto(nonwhite) then { halt("class/read expected declaration on: ",line) } } } halt("class/read syntax error: eof inside a class definition") end procedure classhas_initially(self) #line 286 "idol.iol" return (__self1 := self.text).__methods.size(__self1.__state) > 0 end procedure classispublic(self,fieldname) #line 289 "idol.iol" if (__self1 := self.fields).__methods.ispublic(__self1.__state,fieldname) then return fieldname end procedure classforeachmethod(self) #line 292 "idol.iol" suspend (__self1 := self.methods).__methods.foreach(__self1.__state) end procedure classforeachsuper(self) #line 295 "idol.iol" suspend (__self1 := self.supers).__methods.foreach(__self1.__state) end procedure classforeachfield(self) #line 298 "idol.iol" suspend (__self1 := self.fields).__methods.foreach(__self1.__state) end procedure classtransitive_closure(self) #line 301 "idol.iol" count := (__self1 := self.supers).__methods.size(__self1.__state) while count > 0 do { added := taque() every sc := (__self1 := self.supers).__methods.foreach(__self1.__state) do { if /(super := (__self1 := classes).__methods.lookup(__self1.__state,sc)) then halt("class/transitive_closure: couldn't find superclass ",sc) every supersuper := (__self1 := super).__methods.foreachsuper(__self1.__state) do { if / (__self1 := self.supers).__methods.lookup(__self1.__state,supersuper) & /(__self1 := added).__methods.lookup(__self1.__state,supersuper) then { (__self1 := added).__methods.insert(__self1.__state,supersuper) } } } count := (__self1 := added).__methods.size(__self1.__state) every (__self1 := self.supers).__methods.insert(__self1.__state,(__self2 := added).__methods.foreach(__self2.__state)) } end procedure classwritedecl(self,f,s) #line 323 "idol.iol" writes(f, s," ",self.name) if s=="class" & ( *(supers := (__self1 := self.supers).__methods.String(__self1.__state)) > 0 ) then writes(f," : ",supers) writes(f,"(") rv := (__self1 := self.fields).__methods.String(__self1.__state,s) if *rv > 0 then rv ||:= "," if s~=="class" & \self.ifields then every l := !self.ifields do rv ||:= l.ident || "," writes(f,rv[1:-1]) write(f,,")") end procedure classwritespec(self,f) #line 335 "idol.iol" f := envopen(filename(self.name),"w") (__self1 := self).__methods.writedecl(__self1.__state,f,"class") every (__self2 := ((__self1 := self.methods).__methods.foreach(__self1.__state))).__methods.writedecl(__self2.__state,f,"method") if (__self1 := self).__methods.has_initially(__self1.__state) then write(f,"initially") write(f,"end") close(f) end procedure classwritemethods(self) #line 348 "idol.iol" f:= envopen(filename(self.name)||".icn","w") every (__self2 := ((__self1 := self.methods).__methods.foreach(__self1.__state))).__methods.write(__self2.__state,f,self.name) if \self.glob & *self.glob>0 then { write(f,"#\n# globals declared within the class\n#") every i := 1 to *self.glob do (__self1 := (self.glob[i])).__methods.write(__self1.__state,f,"") } close(f) end procedure classwrite(self) #line 362 "idol.iol" f:= envopen(filename(self.name)||".icn","a") if /self.ifields then (__self1 := self).__methods.resolve(__self1.__state) writes(f,"record ",self.name,"_state(__state,__methods") rv := "," rv ||:= (__self1 := self.fields).__methods.idTaque.String(__self1.__state) if rv[-1] ~== "," then rv ||:= "," every s := (!self.ifields).ident do rv ||:= s || "," write(f,rv[1:-1],")") writes(f,"record ",self.name,"_methods(") rv := "" every s := (((__self2 := ((__self1 := self.methods).__methods.foreach(__self1.__state))).__methods.name(__self2.__state)) | (__self1 := self.fields).__methods.foreachpublic(__self1.__state) | (!self.imethods).ident | (__self1 := self.supers).__methods.foreach(__self1.__state)) do rv ||:= s || "," if *rv>0 then rv[-1] := "" write(f,rv,")") writes(f,"global ",self.name,"__oprec") every writes(f,", ", (__self1 := self.supers).__methods.foreach(__self1.__state),"__oprec") write(f) (__self1 := self).__methods.writedecl(__self1.__state,f,"procedure") write(f,"local self,clone") write(f,"initial {\n", " if /",self.name,"__oprec then ",self.name,"initialize()") if (__self1 := self.supers).__methods.size(__self1.__state) > 0 then every (super <- (__self1 := self.supers).__methods.foreach(__self1.__state)) ~== self.name do write(f," if /",super,"__oprec then ",super,"initialize()\n", " ",self.name,"__oprec.",super," := ", super,"__oprec") write(f," }") writes(f," self := ",self.name,"_state(&null,",self.name,"__oprec") every writes(f,",",(__self1 := self.fields).__methods.foreach(__self1.__state)) if \self.ifields then every writes(f,",",(!self.ifields).ident) write(f,")\n self.__state := self") if (__self1 := self.text).__methods.size(__self1.__state) > 0 then write(f," ",self.name,"initially(self)") if (__self1 := self.supers).__methods.size(__self1.__state) > 0 then { every (super <- (__self1 := self.supers).__methods.foreach(__self1.__state)) ~== self.name do { if (__self2 := ((__self1 := classes).__methods.lookup(__self1.__state,super))).__methods.has_initially(__self2.__state) then { if /madeclone := 1 then { write(f," clone := ",self.name,"_state()\n", " clone.__state := clone\n", " clone.__methods := ",self.name,"__oprec") } write(f," # inherited initialization from class ",super) write(f," every i := 2 to *self do clone[i] := self[i]\n", " ",super,"initially(clone)") every l := !self.ifields do { if l.class == super then write(f," self.",l.ident," := clone.",l.ident) } } } } write(f," return idol_object(self,",self.name,"__oprec)\n", "end\n") write(f,"procedure ",self.name,"initialize()") writes(f," initial ",self.name,"__oprec := ",self.name,"_methods") rv := "(" every s := (__self2 := ((__self1 := self.methods).__methods.foreach(__self1.__state))).__methods.name(__self2.__state) do { if *rv>1 then rv ||:= "," rv ||:= self.name||s } every me := (__self1 := self.fields).__methods.foreachpublic(__self1.__state) do { if *rv>1 then rv ||:= "," rv ||:= self.name||me } every l := !self.imethods do { if *rv>1 then rv ||:= "," rv ||:= l.class||l.ident } write(f,rv,")\n","end") if (__self1 := self).__methods.has_initially(__self1.__state) then { write(f,"procedure ",self.name,"initially(self)") (__self1 := self.text).__methods.write(__self1.__state,f) write(f,"end") } every me := (__self1 := self.fields).__methods.foreachpublic(__self1.__state) do { write(f,"procedure ",self.name,me,"(self)") if \strict then { write(f," if type(self.",me,") == ", "(\"list\"|\"table\"|\"set\"|\"record\") then\n", " runerr(501,\"idol: scalar type expected\")") } write(f," return .(self.",me,")") write(f,"end") write(f) } close(f) end procedure classresolve(self) #line 513 "idol.iol" self.imethods := [] self.ifields := [] ipublics := [] addedfields := table() addedmethods := table() every sc := (__self1 := self.supers).__methods.foreach(__self1.__state) do { if /(superclass := (__self1 := classes).__methods.lookup(__self1.__state,sc)) then halt("class/resolve: couldn't find superclass ",sc) every superclassfield := (__self1 := superclass).__methods.foreachfield(__self1.__state) do { if /(__self1 := self.fields).__methods.lookup(__self1.__state,superclassfield) & /addedfields[superclassfield] then { addedfields[superclassfield] := superclassfield put ( self.ifields , classident(sc,superclassfield) ) if (__self1 := superclass).__methods.ispublic(__self1.__state,superclassfield) then put( ipublics, classident(sc,superclassfield) ) } else if \strict then { warn("class/resolve: '",sc,"' field '",superclassfield, "' is redeclared in subclass ",self.name) } } every superclassmethod := (__self2 := ((__self1 := superclass).__methods.foreachmethod(__self1.__state))).__methods.name(__self2.__state) do { if /(__self1 := self.methods).__methods.lookup(__self1.__state,superclassmethod) & /addedmethods[superclassmethod] then { addedmethods[superclassmethod] := superclassmethod put ( self.imethods, classident(sc,superclassmethod) ) } } every public := (!ipublics) do { if public.class == sc then put (self.imethods, classident(sc,public.ident)) } } end # # globals declared within the class # record classident(class,ident) record class_state(__state,__methods,supers,methods,text,imethods,ifields,glob,name,fields,tag) record class_methods(read,has_initially,ispublic,foreachmethod,foreachsuper,foreachfield,transitive_closure,writedecl,writespec,writemethods,write,resolve,String,name,declaration) global class__oprec, declaration__oprec procedure class(supers,methods,text,imethods,ifields,glob,name,fields,tag) local self,clone initial { if /class__oprec then classinitialize() if /declaration__oprec then declarationinitialize() class__oprec.declaration := declaration__oprec } self := class_state(&null,class__oprec,supers,methods,text,imethods,ifields,glob,name,fields,tag) self.__state := self clone := class_state() clone.__state := clone clone.__methods := class__oprec # inherited initialization from class declaration every i := 2 to *self do clone[i] := self[i] declarationinitially(clone) self.name := clone.name self.fields := clone.fields self.tag := clone.tag return idol_object(self,class__oprec) end procedure classinitialize() initial class__oprec := class_methods(classread,classhas_initially,classispublic,classforeachmethod,classforeachsuper,classforeachfield,classtransitive_closure,classwritedecl,classwritespec,classwritemethods,classwrite,classresolve,declarationString,declarationname) end procedure methodread(self,line,phase) #line 556 "idol.iol" (__self1 := self).__methods.declaration.read(__self1.__state,line) self.text := body() if phase = 1 then (__self1 := self.text).__methods.read(__self1.__state) end procedure methodwritedecl(self,f,s) #line 562 "idol.iol" decl := (__self1 := self).__methods.String(__self1.__state) if s == "method" then decl[1:upto(white,decl)] := "method" else { decl[1:upto(white,decl)] := "procedure" decl[upto(white,decl)] ||:= self.class if *self.class ~= 0 then { i := find("(",decl) decl[i] ||:= "self" || (((decl[i+1] ~== ")"), ",") | "") } } write(f,decl) end procedure methodwrite(self,f) #line 575 "idol.iol" if self.name ~== "initially" then (__self1 := self).__methods.writedecl(__self1.__state,f,"procedure") (__self1 := self.text).__methods.write(__self1.__state,f) self.text := &null end record method_state(__state,__methods,class,text,name,fields,tag) record method_methods(read,writedecl,write,String,name,declaration) global method__oprec, declaration__oprec procedure method(class,text,name,fields,tag) local self,clone initial { if /method__oprec then methodinitialize() if /declaration__oprec then declarationinitialize() method__oprec.declaration := declaration__oprec } self := method_state(&null,method__oprec,class,text,name,fields,tag) self.__state := self clone := method_state() clone.__state := clone clone.__methods := method__oprec # inherited initialization from class declaration every i := 2 to *self do clone[i] := self[i] declarationinitially(clone) self.name := clone.name self.fields := clone.fields self.tag := clone.tag return idol_object(self,method__oprec) end procedure methodinitialize() initial method__oprec := method_methods(methodread,methodwritedecl,methodwrite,declarationString,declarationname) end procedure Globalwrite(self,f) #line 587 "idol.iol" write(f,self.s) end record Global_state(__state,__methods,s) record Global_methods(write) global Global__oprec procedure Global(s) local self,clone initial { if /Global__oprec then Globalinitialize() } self := Global_state(&null,Global__oprec,s) self.__state := self return idol_object(self,Global__oprec) end procedure Globalinitialize() initial Global__oprec := Global_methods(Globalwrite) end procedure Tablesize(self) #line 596 "idol.iol" return (* \ self.t) | 0 end procedure Tableinsert(self,x,key) #line 599 "idol.iol" /self.t := table() /key := x if / (self.t[key]) := x then return end procedure Tablelookup(self,key) #line 604 "idol.iol" if t := \self.t then return t[key] return end procedure Tableforeach(self) #line 608 "idol.iol" if t := \self.t then every suspend !self.t end record Table_state(__state,__methods,t) record Table_methods(size,insert,lookup,foreach) global Table__oprec procedure Table(t) local self,clone initial { if /Table__oprec then Tableinitialize() } self := Table_state(&null,Table__oprec,t) self.__state := self return idol_object(self,Table__oprec) end procedure Tableinitialize() initial Table__oprec := Table_methods(Tablesize,Tableinsert,Tablelookup,Tableforeach) end procedure taqueinsert(self,x,key) #line 619 "idol.iol" /self.l := [] if (__self1 := self).__methods.Table.insert(__self1.__state,x,key) then put(self.l,x) end procedure taqueforeach(self) #line 623 "idol.iol" if l := \self.l then every suspend !self.l end procedure taqueinsert_t(self,x,key) #line 626 "idol.iol" (__self1 := self).__methods.Table.insert(__self1.__state,x,key) end procedure taqueforeach_t(self) #line 629 "idol.iol" suspend (__self1 := self).__methods.Table.foreach(__self1.__state) end record taque_state(__state,__methods,l,t) record taque_methods(insert,foreach,insert_t,foreach_t,size,lookup,Table) global taque__oprec, Table__oprec procedure taque(l,t) local self,clone initial { if /taque__oprec then taqueinitialize() if /Table__oprec then Tableinitialize() taque__oprec.Table := Table__oprec } self := taque_state(&null,taque__oprec,l,t) self.__state := self return idol_object(self,taque__oprec) end procedure taqueinitialize() initial taque__oprec := taque_methods(taqueinsert,taqueforeach,taqueinsert_t,taqueforeach_t,Tablesize,Tablelookup) end procedure idTaqueparse(self,s) #line 639 "idol.iol" s ? { tab(many(white)) while name := tab(find(self.punc)) do { (__self1 := self).__methods.insert(__self1.__state,trim(name)) move(1) tab(many(white)) } if any(nonwhite) then (__self1 := self).__methods.insert(__self1.__state,trim(tab(0))) } return end procedure idTaqueString(self) #line 651 "idol.iol" if /self.l then return "" out := "" every id := !self.l do out ||:= id||self.punc return out[1:-1] end record idTaque_state(__state,__methods,punc,l,t) record idTaque_methods(parse,String,insert,foreach,insert_t,foreach_t,size,lookup,taque,Table) global idTaque__oprec, taque__oprec, Table__oprec procedure idTaque(punc,l,t) local self,clone initial { if /idTaque__oprec then idTaqueinitialize() if /taque__oprec then taqueinitialize() idTaque__oprec.taque := taque__oprec if /Table__oprec then Tableinitialize() idTaque__oprec.Table := Table__oprec } self := idTaque_state(&null,idTaque__oprec,punc,l,t) self.__state := self return idol_object(self,idTaque__oprec) end procedure idTaqueinitialize() initial idTaque__oprec := idTaque_methods(idTaqueparse,idTaqueString,taqueinsert,taqueforeach,taqueinsert_t,taqueforeach_t,Tablesize,Tablelookup) end procedure argListinsert(self,s) #line 663 "idol.iol" if \self.varg then halt("variable arg must be final") if i := find("[",s) then { if not (j := find("]",s)) then halt("variable arg expected ]") s[i : j+1] := "" self.varg := s := trim(s) } (__self1 := self).__methods.idTaque.insert(__self1.__state,s) end procedure argListString(self) #line 672 "idol.iol" return (__self1 := self).__methods.idTaque.String(__self1.__state) || ((\self.varg & "[]") | "") end record argList_state(__state,__methods,varg,punc,l,t) record argList_methods(insert,String,varg,parse,foreach,insert_t,foreach_t,size,lookup,idTaque,taque,Table) global argList__oprec, idTaque__oprec, taque__oprec, Table__oprec procedure argList(varg,punc,l,t) local self,clone initial { if /argList__oprec then argListinitialize() if /idTaque__oprec then idTaqueinitialize() argList__oprec.idTaque := idTaque__oprec if /taque__oprec then taqueinitialize() argList__oprec.taque := taque__oprec if /Table__oprec then Tableinitialize() argList__oprec.Table := Table__oprec } self := argList_state(&null,argList__oprec,varg,punc,l,t) self.__state := self argListinitially(self) return idol_object(self,argList__oprec) end procedure argListinitialize() initial argList__oprec := argList_methods(argListinsert,argListString,argListvarg,idTaqueparse,taqueforeach,taqueinsert_t,taqueforeach_t,Tablesize,Tablelookup) end procedure argListinitially(self) #line 675 "idol.iol" self.punc := "," end procedure argListvarg(self) return .(self.varg) end procedure classFieldsString(self,s) #line 683 "idol.iol" if *(rv := (__self1 := self).__methods.argList.String(__self1.__state)) = 0 then return "" if /s | (s ~== "class") then return rv if (__self1 := self).__methods.ispublic(__self1.__state,self.l[1]) then rv := "public "||rv every field:=(__self1 := self).__methods.foreachpublic(__self1.__state) do rv[find(","||field,rv)] ||:= "public " return rv end procedure classFieldsforeachpublic(self) #line 690 "idol.iol" if \self.publics then every suspend !self.publics end procedure classFieldsispublic(self,s) #line 693 "idol.iol" if \self.publics then every suspend !self.publics == s end procedure classFieldsinsert(self,s) #line 696 "idol.iol" s ? { if ="public" & tab(many(white)) then { s := tab(0) /self.publics := [] put(self.publics,s) } } (__self1 := self).__methods.argList.insert(__self1.__state,s) end record classFields_state(__state,__methods,publics,varg,punc,l,t) record classFields_methods(String,foreachpublic,ispublic,insert,varg,parse,foreach,insert_t,foreach_t,size,lookup,argList,idTaque,taque,Table) global classFields__oprec, argList__oprec, idTaque__oprec, taque__oprec, Table__oprec procedure classFields(publics,varg,punc,l,t) local self,clone initial { if /classFields__oprec then classFieldsinitialize() if /argList__oprec then argListinitialize() classFields__oprec.argList := argList__oprec if /idTaque__oprec then idTaqueinitialize() classFields__oprec.idTaque := idTaque__oprec if /taque__oprec then taqueinitialize() classFields__oprec.taque := taque__oprec if /Table__oprec then Tableinitialize() classFields__oprec.Table := Table__oprec } self := classFields_state(&null,classFields__oprec,publics,varg,punc,l,t) self.__state := self classFieldsinitially(self) clone := classFields_state() clone.__state := clone clone.__methods := classFields__oprec # inherited initialization from class argList every i := 2 to *self do clone[i] := self[i] argListinitially(clone) self.varg := clone.varg return idol_object(self,classFields__oprec) end procedure classFieldsinitialize() initial classFields__oprec := classFields_methods(classFieldsString,classFieldsforeachpublic,classFieldsispublic,classFieldsinsert,argListvarg,idTaqueparse,taqueforeach,taqueinsert_t,taqueforeach_t,Tablesize,Tablelookup) end procedure classFieldsinitially(self) #line 706 "idol.iol" self.punc := "," end